//
//  CellItem.m
//  IOS-7day
//
//  Created by RIOS on 2018/5/1.
//  Copyright © 2018年 RIOS. All rights reserved.
//

#import "CellItem.h"

@interface CellItem  ()
@property (weak, nonatomic) IBOutlet UIImageView *vImageView;
@property (weak, nonatomic) IBOutlet UILabel *vTitle;
@property (weak, nonatomic) IBOutlet UILabel *vBugCount;
@property (weak, nonatomic) IBOutlet UILabel *vPrice;

@end


@implementation CellItem

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

+ (instancetype)buildWithTableVIew:(UITableView *)tableVIew{
    static NSString *cellId = @"cellitem";
    
    CellItem *cell = [tableVIew dequeueReusableCellWithIdentifier:cellId];
    
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"item" owner:nil options:nil]firstObject];
        
        NSDate *date = [NSDate date]; // 获得时间对象
        NSDateFormatter *forMatter = [[NSDateFormatter alloc] init];
//        [forMatter setDateFormat:@"HH-mm-ss yyyy-MM-dd"];
        [forMatter setDateFormat:@"mmss"];
        NSString *dateStr = [forMatter stringFromDate:date];
        NSLog(@"创建cell了:%@",dateStr);
    }
    
    return cell;
    
}

-(void)setGoods:(MGoods *)goods{
    self.vImageView.image = [UIImage imageNamed:goods.icon];
    self.vTitle.text = goods.title;
    self.vPrice.text = [NSString stringWithFormat:@"¥ %@",goods.price];
    self.vBugCount.text = [NSString stringWithFormat:@"%@人已购买",goods.buyCount];
    
}



@end















